﻿@model OSBLE.Models.Courses.CourseUser
@using OSBLE.Models
@using OSBLE.Models.Courses
@using OSBLE.Models.Assignments

@{
    ViewBag.Title = "Edit";
    CourseUser client = ViewBag.ActiveCourseUser as CourseUser;
}

<h2>Edit</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)

    @Html.HiddenFor(model => model.UserProfileID)
    @Html.HiddenFor(model => model.AbstractCourseID)
    @Html.HiddenFor(model => Model.ID);

    <div class="editor-label">
        @Html.LabelFor(model => model.UserProfileID, "Name")
        @Helpers.CreateToolTip(ToolTips.RosterUserName)
    </div>
    <div class="editor-label">
        <input type="text" disabled="disabled" value="@Model.UserProfile.FirstName @Model.UserProfile.LastName" />
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.UserProfileID, "StudentID")
    </div>
    <div class="editor-label">
        <input type="text" disabled="disabled" value="@Model.UserProfile.Identification" />
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.UserProfileID, "Email")
        @Helpers.CreateToolTip(ToolTips.RosterEmail)
    </div>
    <div class="editor-label">
        <input type="text" disabled="disabled" value="@Model.UserProfile.Email" />
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.Section)
        @Helpers.CreateToolTip(ToolTips.RosterSection)
    </div>
    <div class="editor-field" style="display:none;">
        @Html.TextBoxFor(model => model.Section, new { size = 3 })
        @Html.ValidationMessageFor(model => model.Section)
        <input type="hidden" name="CurrentMultiSection" value="@ViewBag.CurrentMultiSection" />
    </div>

    <div class="editor-label">
        @if (Model.Section == -2)
        {
            <input type="text" value="All Sections" disabled />
        }
        else if (Model.Section == -1)
        {
            <input type="text" value="@ViewBag.CurrentMultiSection.Substring(0, ViewBag.CurrentMultiSection.Length - 1)" disabled />
        }
        else
        {
            <input type="text" value="@Model.Section" disabled />
        }
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.AbstractRoleID, "Course Role")
        @Helpers.CreateToolTip(ToolTips.RosterRole)
    </div>
    <div class="editor-field">
        @Html.DropDownList("AbstractRoleID")
        @Html.ValidationMessageFor(model => model.AbstractRoleID)
        <input type="hidden" name="OldAbstractRoleId" value="@ViewBag.OldAbstractRoleID" />
    </div>
    <br />
    <p>
        <input type="submit" value="Save User" />
    </p>
}

<div>
    @Html.ActionLink("Back to Users", "Index")
</div>
